import { useMatch, useParams } from "react-router-dom";

function Article() {
  // 对象格式直接是 /article/:id   {id:xxx}
  const res = useParams();
  console.log(useMatch("/article/:id/:uname"));

  console.log(res);
  const { id, uname } = res;
  return (
    <div>
      我是一个文章列表页面
      {id && (
        <p>
          我的id是—— p:{id}--{uname}
        </p>
      )}
    </div>
  );
}
export default Article;
